<?php

/**
 * NotificationSettings form base class.
 *
 * @method NotificationSettings getObject() Returns the current form's model object
 *
 * @package    ecollegeplus
 * @subpackage form
 * @author     Batanayi Matuku
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseNotificationSettingsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                              => new sfWidgetFormInputHidden(),
      'can_receive_email'               => new sfWidgetFormInputCheckbox(),
      'can_receive_reply'               => new sfWidgetFormInputCheckbox(),
      'can_receive_peer_activities'     => new sfWidgetFormInputCheckbox(),
      'can_receive_news_alerts'         => new sfWidgetFormInputCheckbox(),
      'can_receive_announcement_alerts' => new sfWidgetFormInputCheckbox(),
      'can_receive_event_alerts'        => new sfWidgetFormInputCheckbox(),
      'can_receive_discussion_updates'  => new sfWidgetFormInputCheckbox(),
      'can_receive_course_updates'      => new sfWidgetFormInputCheckbox(),
      'can_receive_assignment_due'      => new sfWidgetFormInputCheckbox(),
      'can_receive_system_updates'      => new sfWidgetFormInputCheckbox(),
      'can_receive_system_maintenance'  => new sfWidgetFormInputCheckbox(),
      'user_id'                         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'can_receive_email'               => new sfValidatorBoolean(array('required' => false)),
      'can_receive_reply'               => new sfValidatorBoolean(array('required' => false)),
      'can_receive_peer_activities'     => new sfValidatorBoolean(array('required' => false)),
      'can_receive_news_alerts'         => new sfValidatorBoolean(array('required' => false)),
      'can_receive_announcement_alerts' => new sfValidatorBoolean(array('required' => false)),
      'can_receive_event_alerts'        => new sfValidatorBoolean(array('required' => false)),
      'can_receive_discussion_updates'  => new sfValidatorBoolean(array('required' => false)),
      'can_receive_course_updates'      => new sfValidatorBoolean(array('required' => false)),
      'can_receive_assignment_due'      => new sfValidatorBoolean(array('required' => false)),
      'can_receive_system_updates'      => new sfValidatorBoolean(array('required' => false)),
      'can_receive_system_maintenance'  => new sfValidatorBoolean(array('required' => false)),
      'user_id'                         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
    ));

    $this->widgetSchema->setNameFormat('notification_settings[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'NotificationSettings';
  }

}
